<?php
namespace app\libraryadmin\controller;
use \think\Db;
use \think\Session;
class Comment extends Common
{
	public function index()
	{

	}
	public function libcomment()
	{
		$laid=Session::get('login_laid');
		$rs=Db::name("libraryadmin")->where("laid=$laid")->find();
		//var_dump($rs);
		$lid=$rs['lid'];
		$com=Db::query("select * from users u, comments c , librarys l where c.id=$lid and l.lid=$lid and u.uid=c.uid and bln=2 order by cid desc");
		//var_dump($com);
		$this->assign("com",$com);
		return $this->fetch();
		
	}
	public function comdelete($cid)
	{
		$rs=Db::name("comments")->where("cid=$cid")->delete();
		if($rs)
			$this->success("删除成功");
		else $this->error("删除失败");
	}
	public function bookcomment()
	{	
		$laid=Session::get('login_laid');
		$com=Db::query("select * from comments c,users u,books b where c.uid=u.uid and b.laid=$laid and c.id=b.bid and bln=1 order by cid desc");
		//var_dump($com);
		$this->assign("com",$com);
		return $this->fetch();

	}
}